Skip to content

ArrayListVsList: retarget net10.0, add mixed-type ArrayList cast demonstration - #2131

Merged
vladimir-pecanac-main merged 2 commits into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/88631-csharp-arraylist-vs-list
Aug 27, 2026
Merged

ArrayListVsList: retarget net10.0, add mixed-type ArrayList cast demonstration#2131
vladimir-pecanac-main merged 2 commits into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/88631-csharp-arraylist-vs-list

Conversation

@vladimir-pecanac-main

Copy link
Copy Markdown
Collaborator

Retargets collections-lists/ArrayListVsList from net7.0 to net10.0 (both projects).

Adds a mixed-type ArrayList to the sample with two read paths: a matching cast that returns the value, and a wrong cast that compiles and throws InvalidCastException at run time. Two tests cover them. The new members live on Collection, not in Program.cs, so the sample still runs to completion.

Build clean (0 warnings, 0 errors), 5/5 tests pass on .NET 10.0.10.

…nstration

Retargets both projects from net7.0 to net10.0. Adds a mixed-type
ArrayList to the sample with two read paths - a matching cast that
returns the value and a wrong cast that compiles and throws
InvalidCastException at run time - plus two tests covering them.
Kept out of Program.cs so the sample still runs to completion.
@vladimir-pecanac-main
vladimir-pecanac-main merged commit 4f97f2b into CodeMazeBlog:main Aug 27, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant